package cate.game.activity.convertgod.msg;

import cate.common.util.GameResult;
import cate.game.GameBody;
import cate.game.activity.convertgod.ConvertGodActivity;
import cate.game.client.ClientContext;
import cate.game.client.msg.ClientMsg;
import cate.game.client.msg.MsgConfig;
import cate.game.client.msg.MsgInput;
import cate.game.client.msg.id.MsgIdBConvertGod;
import easy.java.dev.note.NoteField;

@ClientMsg(title = "神装置换 的 请求")
public class ConvertGodReq implements MsgInput {
    @NoteField("活动的功能id")
    public int funcId;
    @NoteField("用于置换的装备uid")
    public String uid;
    @NoteField("置换目标装备的tid")
    public int tid;

    @Override
    public void execute(GameBody game, ClientContext cc) {
        ConvertGodActivity hero = cc.getRole().getActivity().getEnableActivitySingle(funcId);
        if (hero == null) {
            cc.getRole().getGame().notice.message(cc.getRole(), "活动未开启");
            return;
        }
        GameResult<ConvertGodActivity> r = hero.convert(uid, tid);
        if (!r.ok()) {
            game.notice.message(cc.getRole(), r.message);
        }
    }

    @Override
    public MsgConfig conf() {
        return MsgIdBConvertGod.CONVERT_GOD_REQ;
    }
}
